<template>
  <div>
    <h1>post请求test</h1>
    用户名：<input type="text" v-model="userName" /><br />
    密码：<input type="text" v-model="password" /><br />
    <button @click="register">注册</button>
  </div>
</template>

<script>
import ajax from "@/utils/request.js";
export default {
  data() {
    return {
      userName: "",
      password: "",
    };
  },
  methods: {
    async register() {
      let user = {
        user_name: this.userName,
        password: this.password,
      };
      console.log(user);
      let result = await ajax({
        method: "post",
        url: "/register",
        params: user,
        headType: "form",
      });
      console.log(result);
    },
  },
};
</script>

<style lang="scss" scoped>
</style>